//
//  ScrollModel.m
//  WangI
//
//  Created by dllo on 15/11/23.
//  Copyright © 2015年 WJN. All rights reserved.
//

#import "ScrollModel.h"
#import "AdsModel.h"

@implementation ScrollModel

- (instancetype)initWithDictionary:(NSDictionary *)data
{
    self = [super init];
    if (self) {
        [self setValuesForKeysWithDictionary:data];
    }
    return self;
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key {
    if ([key isEqualToString:@"ads"]) {
        NSArray *array = value;
        
        NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:0];
        for (NSDictionary *dic in array) {
            AdsModel *adsModel = [[AdsModel alloc] initWithDictionary:dic];
            [mutableArray addObject:adsModel];
        }
        _adsArray = [[NSArray alloc] initWithArray:mutableArray];
    }
}

- (id)valueForUndefinedKey:(NSString *)key {
    return nil;
}

@end
